﻿@page "/manage/banner"
@using BlazorCommunity.DTO.Admin
@inherits BannerManageBase

<BForm Inline="true">
    <BButton Type="@ButtonType.Success" Icon="el-icon-plus" OnClick="New" IsPlain="true" IsDisabled="false" Style="float:right;margin-right:100px;">新增</BButton>
</BForm>

<div class="el-divider el-divider--horizontal" style="margin: 5px 0;"><!----></div>

<BTable DataSource="Datas" Total="DataCount" @bind-CurrentPage="CurrentPage" PageSize="pageSize" @ref="table" HasSelectionColumn="false" IsStripe="true" AutoGenerateColumns="false">
    <BTableColumns>
        <BTableColumn Width="300" Property="@nameof(BannerDisplayDto.BannerImg)" Text="图片" Style="text-align:center;">
            @{
                BannerDisplayDto banner = ((BannerDisplayDto)context);
                <img src="@(banner.BannerImg)" style="width:100%;height:100px;" title="@banner.Title" />
            }
        </BTableColumn>
        <BTableColumn Width="300" Property="@nameof(BannerDisplayDto.Title)" Text="图片描述" Style="text-align:center;"> </BTableColumn>
        <BTableColumn Width="100" Property="@nameof(BannerDisplayDto.CreateDate)" Format="yyyy-MM-dd" Text="创建时间" Style="text-align:center;"></BTableColumn>
        <BTableColumn Width="100" Property="@nameof(BannerDisplayDto.Show)" Text="是否显示" Style="text-align:center;"></BTableColumn>
        <BTableTemplateColumn Text="操作" Width="150">

            <BButton Type="@ButtonType.Primary" Size="@ButtonSize.Small" IsPlain="true" OnClick="@(e=> Modify(context))" IsDisabled="false">   编辑   </BButton>
            @{

                var banner = (BannerDisplayDto)context;
                if (banner.Status == 0)
                {
                    <BButton Type="@ButtonType.Danger" Size="@ButtonSize.Small" IsPlain="true" OnClick="@(e=> Delete(context))">删除</BButton>
                }
                else
                {
                    <BButton Type="@ButtonType.Success" Size="@ButtonSize.Small" IsPlain="true" OnClick="@(e=> Resume(context))">恢复</BButton>
                }

            }
        </BTableTemplateColumn>
    </BTableColumns>
</BTable>